﻿namespace QLBanHang.UC
{
    using ConfigDatabase.Class;
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraTab;
    using Access.Chung;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class UCthongso : XtraUserControl
    {
        private ConnectDatabase _condata;
        private CThongSo _tschung;
        private SimpleButton btnketthuc;
        private SimpleButton btnluu;
        private IContainer components = null;
        private Label label25;
        private TextEdit txttencoso;
        private Label label1;
        private TextEdit txtdiachi;
        private Label label2;
        private TextEdit txtdienthoai;
        private Label label4;
        private TextEdit txtemail;
        private Label label3;

        public UCthongso()
        {
            this.InitializeComponent();
        }

        private void btnketthuc_Click(object sender, EventArgs e)
        {
            try
            {
                XtraTabPage parent = (XtraTabPage) base.Parent;
                XtraTabControl control = (XtraTabControl) parent.Parent;
                control.TabPages.Remove(parent);
            }
            catch
            {
                try
                {
                    XtraUserControl control2 = (XtraUserControl) base.Parent;
                    control2.Controls.Remove(this);
                }
                catch
                {
                    ((Form) base.Parent).Close();
                }
            }
        }

        private void btnluu_Click(object sender, EventArgs e)
        {
            this.f_thongso_save();
            MessageBox.Show("Lưu th\x00e0nh c\x00f4ng.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK);
        }

        
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void f_thongso_load()
        {
           
            this.txttencoso.Text = this._tschung.pTenCoSo;
            this.txtdiachi.Text = this._tschung.pDiaChi;
            this.txtdienthoai.Text = this._tschung.pDienThoai;
            this.txtemail.Text = this._tschung.pEmail;
        }

        private void f_thongso_save()
        {
            this._tschung.pTenCoSo = txttencoso.Text;
            this._tschung.pDiaChi = txtdiachi.Text;
            this._tschung.pDienThoai = txtdienthoai.Text;
            this._tschung.pEmail = txtemail.Text;
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCthongso));
            this.btnketthuc = new DevExpress.XtraEditors.SimpleButton();
            this.btnluu = new DevExpress.XtraEditors.SimpleButton();
            this.label3 = new System.Windows.Forms.Label();
            this.label25 = new System.Windows.Forms.Label();
            this.txttencoso = new DevExpress.XtraEditors.TextEdit();
            this.label1 = new System.Windows.Forms.Label();
            this.txtdiachi = new DevExpress.XtraEditors.TextEdit();
            this.label2 = new System.Windows.Forms.Label();
            this.txtdienthoai = new DevExpress.XtraEditors.TextEdit();
            this.label4 = new System.Windows.Forms.Label();
            this.txtemail = new DevExpress.XtraEditors.TextEdit();
            ((System.ComponentModel.ISupportInitialize)(this.txttencoso.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtdiachi.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtdienthoai.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtemail.Properties)).BeginInit();
            this.SuspendLayout();
            // 
            // btnketthuc
            // 
            this.btnketthuc.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.btnketthuc.Appearance.Options.UseTextOptions = true;
            this.btnketthuc.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
            this.btnketthuc.Image = ((System.Drawing.Image)(resources.GetObject("btnketthuc.Image")));
            this.btnketthuc.Location = new System.Drawing.Point(273, 160);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new System.Drawing.Size(79, 23);
            this.btnketthuc.TabIndex = 5;
            this.btnketthuc.Text = " &Kết thúc";
            this.btnketthuc.Click += new System.EventHandler(this.btnketthuc_Click);
            // 
            // btnluu
            // 
            this.btnluu.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.btnluu.Appearance.Options.UseTextOptions = true;
            this.btnluu.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
            this.btnluu.Image = global::QLBanHang.Resources.Reso.imgsave;
            this.btnluu.Location = new System.Drawing.Point(206, 160);
            this.btnluu.Name = "btnluu";
            this.btnluu.Size = new System.Drawing.Size(63, 23);
            this.btnluu.TabIndex = 4;
            this.btnluu.Text = " &Lưu";
            this.btnluu.Click += new System.EventHandler(this.btnluu_Click);
            // 
            // label3
            // 
            this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(163)));
            this.label3.Location = new System.Drawing.Point(3, 49);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(130, 26);
            this.label3.TabIndex = 23;
            this.label3.Text = "Đơn vị sử dụng:";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // label25
            // 
            this.label25.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.label25.BackColor = System.Drawing.Color.Green;
            this.label25.Font = new System.Drawing.Font("Tahoma", 16F);
            this.label25.ForeColor = System.Drawing.Color.White;
            this.label25.Location = new System.Drawing.Point(0, 0);
            this.label25.Name = "label25";
            this.label25.Size = new System.Drawing.Size(588, 45);
            this.label25.TabIndex = 26;
            this.label25.Text = "THÔNG TIN";
            this.label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // txttencoso
            // 
            this.txttencoso.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txttencoso.Location = new System.Drawing.Point(130, 54);
            this.txttencoso.Name = "txttencoso";
            this.txttencoso.Size = new System.Drawing.Size(445, 20);
            this.txttencoso.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(163)));
            this.label1.Location = new System.Drawing.Point(3, 73);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(130, 26);
            this.label1.TabIndex = 23;
            this.label1.Text = "Địa chỉ:";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // txtdiachi
            // 
            this.txtdiachi.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtdiachi.Location = new System.Drawing.Point(130, 78);
            this.txtdiachi.Name = "txtdiachi";
            this.txtdiachi.Size = new System.Drawing.Size(445, 20);
            this.txtdiachi.TabIndex = 1;
            // 
            // label2
            // 
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(163)));
            this.label2.Location = new System.Drawing.Point(3, 99);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(130, 26);
            this.label2.TabIndex = 23;
            this.label2.Text = "Điện thoại:";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // txtdienthoai
            // 
            this.txtdienthoai.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtdienthoai.Location = new System.Drawing.Point(130, 104);
            this.txtdienthoai.Name = "txtdienthoai";
            this.txtdienthoai.Size = new System.Drawing.Size(445, 20);
            this.txtdienthoai.TabIndex = 2;
            // 
            // label4
            // 
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(163)));
            this.label4.Location = new System.Drawing.Point(3, 125);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(130, 26);
            this.label4.TabIndex = 23;
            this.label4.Text = "Email:";
            this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            // 
            // txtemail
            // 
            this.txtemail.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.txtemail.Location = new System.Drawing.Point(130, 130);
            this.txtemail.Name = "txtemail";
            this.txtemail.Size = new System.Drawing.Size(445, 20);
            this.txtemail.TabIndex = 3;
            // 
            // UCthongso
            // 
            this.Controls.Add(this.txtemail);
            this.Controls.Add(this.txtdienthoai);
            this.Controls.Add(this.txtdiachi);
            this.Controls.Add(this.txttencoso);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label25);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.btnluu);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.btnketthuc);
            this.Controls.Add(this.label3);
            this.LookAndFeel.UseWindowsXPTheme = true;
            this.Name = "UCthongso";
            this.Size = new System.Drawing.Size(588, 186);
            this.Load += new System.EventHandler(this.UCphanquyensudung_Load);
            ((System.ComponentModel.ISupportInitialize)(this.txttencoso.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtdiachi.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtdienthoai.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtemail.Properties)).EndInit();
            this.ResumeLayout(false);

        }

        private void UCphanquyensudung_Load(object sender, EventArgs e)
        {
            if (this._condata == null)
            {
                this._condata = new ConnectDatabase();
            }
            this._tschung = new CThongSo(_condata);
            this.f_thongso_load();
        }

        public ConnectDatabase pCondata
        {
            get
            {
                return this._condata;
            }
            set
            {
                this._condata = value;
            }
        }

    }
}

